﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccreditWorkflow.aspx.cs"
    Inherits="ZX.WebApp.WorkFlow.AccreditWorkflow" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>流程授权</title>
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../Styles/base.css" rel="stylesheet" type="text/css" />
    <link href="../../Css/hfmenu.css" type="text/css" rel="stylesheet" />
    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/CombinButton.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/treeview/treeview-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
    <link href="../Styles/extendTable.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        //         function showdialogusers() {

        //             var rv = window.showModalDialog("SelectUsers.aspx", window, "dialogWidth:580px;dialogHeight:480px");

        //             var txtReturnValue = document.getElementById("txtUsers");
        //             if (rv != undefined) {
        //                 txtReturnValue.value = rv;
        //             }
        //         }

        function Button1_onclick() {
            window.close();
        }


        function CheckAll(oCheckbox) {
            var GridView2 = document.getElementById("<%=gvAccredit.ClientID %>");
            for (i = 1; i < GridView2.rows.length; i++) {
                GridView2.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = oCheckbox.checked;
            }
        }
        YAHOO.namespace("example.container")
        function ShowDialog(fn, id,src) {
            var handleSubmit = function () {
                var editwindow = document.getElementById("EditUIWindow4");
                if (editwindow) {
                    editwindow.contentWindow.ChooseInfo();
                }
                YAHOO.example.container.dialog3.hide();
            };
            var handleCancel = function () {
                this.cancel();
            };
            var handleSuccess = function (o) {
                var response = o.responseText;
                response = response.split("<!")[0];
                document.getElementById("resp").innerHTML = response;
            };
            var handleFailure = function (o) {
                alert("Submission failed: " + o.status);
                //                  var response = o.responseText;
                //                  response = response.split("<!")[0];
                //                  document.getElementById("resp").innerHTML = response;
            };
            var handleFailure = function (o) {
                alert('出错了handleFailure');
            };
            var const_EditWindowWidth = "400px",
		const_EditWindowHeight = "300px";
            // Remove progressively enhanced content class, just before creating the module
            YAHOO.util.Dom.removeClass("dialog3", "yui-pe-content");

            // Instantiate the Dialog
            YAHOO.example.container.dialog3 = new YAHOO.widget.Dialog("dialog3",
							    { width: const_EditWindowWidth,
							        height: const_EditWindowHeight,
							        fixedcenter: true,
							        visible: false,
							        draggable: true,
							        close: true,
							        autofillheight: "body",
							        constraintoviewport: true,
							        buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								          { text: "取消", handler: handleCancel}]
							    });
            // Wire up the success and failure handlers
            YAHOO.example.container.dialog3.callback = { success: handleSuccess,
                failure: handleFailure
            };
            // Render the Dialog
            YAHOO.example.container.dialog3.render();
            _fn = fn;
            _id = id;
            document.getElementById("EditUIWindow4").src = src;
            YAHOO.example.container.dialog3.show();
        }

    </script>
    <base target="_self" />
</head>
<body style="font-size: 9pt">
    <form id="form1" runat="server">
    <table style="width: 100%; height: 100%;border: 0px solid #CCCCCC">
        <tr>
            <td colspan="2" bgcolor="#ffffff" height="15">
            </td>
        </tr>
        <tr>
            <td style="width: 50px;border: 1px solid #CCCCCC" valign="top">
                <div>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <%--        <tr>
                            <td>
                                <img height="12" src="../Images/WorkFlow/index_101.gif" width="12" />
                            </td>
                            <td background="../Images/WorkFlow/index_111.gif" style="width: 86px">
                                <img height="1" src="../Images/WorkFlow/spacer.gif" width="1" />
                            </td>
                            <td>
                                <img height="12" src="../Images/WorkFlow/index_121.GIF" width="12" />
                            </td>
                        </tr>--%>
                        <tr>
                           <%-- <td background="../Images/WorkFlow/index_08.gif" width="12">
                                &nbsp;
                            </td>--%>
                            <td style="width: 86px">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                <tr>
                                                    <td align="left" style="height: 174px;border:0px" >
                                                        <asp:TreeView ID="tvWorkflow" runat="server"  ExpandDepth="2" NodeIndent="15" ShowLines="True">
                                                            <ParentNodeStyle Font-Bold="False" Font-Size="9pt" />
                                                            <HoverNodeStyle Font-Size="9pt" Font-Underline="True" />
                                                            <SelectedNodeStyle Font-Bold="True" Font-Size="9pt" Font-Underline="False" HorizontalPadding="0px"
                                                                VerticalPadding="0px" />
                                                            <NodeStyle Font-Size="9pt" HorizontalPadding="0px" NodeSpacing="0px" VerticalPadding="0px" />
                                                        </asp:TreeView>
                                                    </td>
                                                </tr>
                                            </table>
                                            <asp:Label ID="lblError" runat="server" CssClass="font_error"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                           <%-- <td background="../Images/WorkFlow/index_09.gif" width="12">
                            </td>--%>
                        </tr>
                <%--        <tr>
                            <td>
                                <img height="12" src="../Images/WorkFlow/index_10.GIF" width="12" />
                            </td>
                            <td background="../Images/WorkFlow/index_11.gif" style="width: 86px">
                                <img height="1" src="../Images/WorkFlow/spacer.gif" width="1" />
                            </td>
                            <td>
                                <img height="12" src="../Images/WorkFlow/index_12.gif" width="12" />
                            </td>
                        </tr>--%>
                    </table>
                </div>
            </td>
            <td valign="top" style="width: 545px; font-family: Arial; border: 0px solid #CCCCCC"  >
                <table style="width: 100%;" cellpadding="0" cellspacing="0">
                    <tr  style="height:25px">
                        <td colspan="2"  style="border: 1px solid #CCCCCC; border-bottom:none" align="left">
                            <span style="font-size: 8pt">为下列用户授予左侧选择的处理权限：</span>
                        </td>
                    </tr>
                    <tr style="font-size: 9pt; height:25px" >
                        <td style="width: 40%;border: 1px solid #CCCCCC;border-bottom:none" align="left">
                            <input type="hidden" id="CustomId" runat="server" name="CustomId" />
                            <input id="txtCustomId" runat="server" readonly="readonly" name="txtCustomId" type="text"
                                style="width: 80%" />
                            <%--<asp:TextBox ID="txtUsers" runat="server" BorderStyle="Groove" Width="221px"></asp:TextBox>--%>
                        </td>
                        <td style="width: 70%;border: 1px solid #CCCCCC;border-bottom:none">
                            <button id="btnCustomId" name="n" type="button" class="btnCheck" style="width: 70px">
                                选择用户</button>
                            <%--<input id="Button2" onclick="showdialogusers()" style="width: 61px" type="button"
                                    value="选择用户" />--%>
                        </td>
                    </tr>
                    <tr style="font-size: 9pt;height:25px">
                        <td colspan="2" style="border: 1px solid #CCCCCC; border-bottom:none;width:10%" >
                          <asp:Button ID="btnOk" runat="server" Text="授权" OnClick="btnOk_Click" />
                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                           <asp:Label ID="Label1" runat="server" Font-Names="Arial" Font-Size="9pt" ForeColor="#FF3300" 
                                Text="重复授权无效!"></asp:Label>
                        </td>
                       
                    </tr>
                    <tr style="font-size: 9pt; height:25px">
                        <td colspan="2" style="border: 1px solid #CCCCCC;border-bottom:none">
                            您已授出的权限：
                        </td>
                    </tr>
                    <tr style="font-size: 9pt;">
                        <td colspan="2" style="border: 1px solid #CCCCCC;border-bottom:none">
                            <div style="height: 100%; width: 100%; overflow: auto">
                                <asp:GridView ID="gvAccredit" runat="server" Width="100%" AutoGenerateColumns="False"
                                    CellPadding="4" ForeColor="#333333" GridLines="None" DataKeyNames="AccreditId"
                                    Font-Names="Arial" Font-Size="9pt" EnableModelValidation="True">
                                    <Columns>
                                        <asp:TemplateField ItemStyle-Width="20%">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="ItemCheckBox" runat="server" />
                                            </ItemTemplate>
                                            <HeaderTemplate>
                                                <input id="Checkbox2" type="checkbox" onclick="CheckAll(this)" />全选
                                            </HeaderTemplate>
                                            <ItemStyle />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="flowcaption" HeaderText="流程名">
                                            <ItemStyle Width="30%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="taskcaption" HeaderText="任务名">
                                            <ItemStyle Width="30%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="ToUserName" HeaderText="授予">
                                            <ItemStyle Width="30%" />
                                        </asp:BoundField>
                                    </Columns>
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
                                    <EditRowStyle BackColor="#2461BF" />
                                    <AlternatingRowStyle BackColor="White" />
                                </asp:GridView>
                            </div>
                            &nbsp;
                        </td>
                    </tr>
                    <tr style="font-size: 9pt;height:25px">
                        <td colspan="2" style="border: 1px solid #CCCCCC;border-bottom:none">
                            &nbsp;&nbsp;
                            <asp:Button ID="btnTackAccredit" runat="server" Text="取消授权" OnClick="btnTackAccredit_Click" />
                        </td>
                    </tr>
                    <tr style="font-size: 9pt;height:25px">
                        <td colspan="2"  style="border: 1px solid #CCCCCC;border-bottom:none" align="left">
                            被授予的权限：
                        </td>
                    </tr>
                    <tr style="font-size: 9pt;">
                        <td colspan="2" style="border: 1px solid #CCCCCC">
                            <asp:GridView ID="gvHaveAccredit" runat="server" Width="100%" AutoGenerateColumns="False"
                                CellPadding="4" ForeColor="#333333" GridLines="None" DataKeyNames="AccreditId"
                                Font-Names="Arial" Font-Size="9pt" EnableModelValidation="True">
                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#EFF3FB" />
                                <Columns>
                                    <asp:BoundField DataField="flowcaption" HeaderText="流程名">
                                        <ItemStyle Width="30%" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="taskcaption" HeaderText="任务名">
                                        <ItemStyle Width="30%" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="fromUserName" HeaderText="授权者">
                                        <ItemStyle Width="30%" />
                                    </asp:BoundField>
                                </Columns>
                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
                                <EditRowStyle BackColor="#2461BF" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr style="font-size: 9pt">
            <td style="width: 50px">
            </td>
            <td style="width: 545px">
            </td>
        </tr>
        <tr>
            <td colspan="2" class="yui-skin-sam">
                <div id="dialog3" class="yui-pe-content" />
                <div class="hd"></div>
                <div class="bd">
                    <iframe id="EditUIWindow4" frameborder="0" src="" style="width: 100%; height: 100%;
                        margin: 0px; padding: 0px;"></iframe>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
